/**
 * Created by Administrator on 2018/7/24.
 */
$CertusJsonAjax.ajax("queryContractTrace",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.processCCBXTrace = res.data;
})
$CertusJsonAjax.ajax("contractInfoBacklog",{
    "processInstanceId": $CertusJsonAjax.getProInstanceId(),
    "stepInstanceId": $CertusJsonAjax.getStepInstanceId()
},function(res){
    $$scope.contractInfo = res.data.contractInfo;
    $$scope.contractInfo.contractSignTime = $$filter("date")($$scope.contractInfo.contractSignTime, "yyyy-MM-dd");
    $$scope.contractInfo.stepInstanceId = $CertusJsonAjax.getStepInstanceId();
    $$scope.projInfo = res.data.projInfo;
})


$$scope.contractInfoVeto = function(){
    $$scope.contractInfo.originReason = "veto"
    $CertusJsonAjax.ajax("vetoContractInfo",$$scope.contractInfo,function(res){
        if(res.data){
            if(res.data == "success"){
                window.history.back()
            }
        }
    })
}

$$scope.contractInfoPromise = function(){
    $$scope.contractInfo.originReason = "promise"
    $CertusJsonAjax.ajax("promiseContractInfo",$$scope.contractInfo,function(res){
        if(res.data){
            if(res.data == "success"){
                window.history.back()
            }
        }
    })
}

$$scope.contractInfoDenied = function(){
    $$scope.contractInfo.originReason = "denied"
    $CertusJsonAjax.ajax("unPromiseContractInfo",$$scope.contractInfo,function(res){
        if(res.data){
            if(res.data == "success"){
                window.history.back()
            }
        }
    })
}

$$scope.getState = function(a){
    if(a == "1"){
        return "运行中"
    }else if(a == "2"){
        return "已关闭"
    }else if(a == "3"){
        return "已完结"
    }else if(a == "4"){
        return "已暂停"
    }
}

$$scope.getProjLv = function (projLv) {
    if (projLv == "1") {
        return "低";
    } else if (projLv == "2") {
        return "中";
    } else if (projLv == "3") {
        return "高"
    }
}